<form data-bv-feedbackicons-validating="glyphicon glyphicon-refresh" data-bv-feedbackicons-invalid="glyphicon glyphicon-remove" data-bv-feedbackicons-valid="glyphicon glyphicon-ok" data-bv-message="值不能为空" class="form-horizontal bv-form" method="post" id="loginForm" novalidate>
  <div class="form-group has-feedback">
    <label class="col-lg-3 control-label">用户名</label>
    <div class="col-lg-9">
      <input class="form-control" id="username" name="username" placeholder="用户名/邮箱" type="text" value="" data-bv-notempty="true" data-bv-notempty-message="&lt;i class='fa fa-frown-o'&gt;&lt;/i&gt; 对不起！请输入用户名！" data-bv-stringlength="true" data-bv-stringlength-min="3" data-bv-stringlength-message="&lt;i class='fa fa-frown-o'&gt;&lt;/i&gt; 对不起！用户名有误,用户名长度不能小于3位！"/>
      <i style="" class="form-control-feedback glyphicon glyphicon-user" data-bv-field="username"></i></div>
  </div>
  <div class="form-group has-feedback">
    <label class="col-lg-3 control-label">密码</label>
    <div class="col-lg-9">
      <input type="password" value="" data-bv-field="password" class="form-control" AUTOCOMPLETE="off"  name="password" data-bv-notempty="true" data-bv-notempty-message="&lt;i class='fa fa-frown-o'&gt;&lt;/i&gt; 对不起！请输入密码！" data-bv-stringlength="true" data-bv-stringlength-min="6" data-bv-stringlength-message="&lt;i class='fa fa-frown-o'&gt;&lt;/i&gt; 对不起！密码长度不能小于6位！">
      <i style="" class="form-control-feedback glyphicon glyphicon-lock" data-bv-field="password"></i></i> </div>
  </div>
  
  <div class="form-group has-feedback" id="MobileCode" style="display:none">
    <label class="col-lg-3 control-label">手机验证码</label>
    <div class="col-lg-9">
      <input type="text" name="mobilecode" class="form-control" AUTOCOMPLETE="off" >
      <i class="form-control-feedback glyphicon glyphicon-eye-open" data-bv-field="mobilecode"></i>
      <small data-bv-validator-for="mobilecode" class="help-block" id="MobileCodeHelp"></small> 
      </div>
  </div>
  

  {if C('Geetest_Key')}
  <div class="form-group has-feedback">
    <div class="col-lg-offset-3 col-lg-9" id="ShowSecCode">{hook VerifyCode}</div>
  </div>
  {else}
     <div class="form-group has-feedback">
        <label class="col-lg-3 control-label">验证码</label>
        <div class="col-lg-9">
          <input type="text" name="seccode" class="form-control" AUTOCOMPLETE="off" >
          <i class="form-control-feedback glyphicon glyphicon-eye-open" data-bv-field="seccode"></i> </div>
      </div>
      <div class="form-group has-feedback">
      <div class="col-lg-offset-3"><div id="ShowSecCode" class="col-lg-9"></div></div>
      </div>
    <script>

        function seccode(){
             var img='/VerifyCode?rand='+Math.random();
             $('#ShowSecCode').html('<a href="javascript:;" onclick="refreshcode()" style="cursor:hand;" title="点击换一张验证码"><img id="img_seccode" src="'+img+'"></a>');
             $("#SecCode").val("");
        }
        
        function refreshcode() {
            
            var img = '/VerifyCode?rand='+Math.random();
            if(document.getElementById('img_seccode')) {
                $('#img_seccode').attr("src",img);
            }
        }
        
        $(function(){
        
              seccode();
        
        });
    </script>
    {/if}
  
  
  <div class="form-group has-feedback">
    <div class="checkbox">
      <label class="col-lg-offset-3 col-lg-9">
        <input name="remember" checked="checked" class="inverted" type="checkbox" data-bv-field='remember'/>
        <span class="text">记住我登录</span> &nbsp; <a href="/forgotpassword">忘记密码? </a></div> </label> 
  </div>
  <div class="form-group">
    <div class="col-lg-offset-3 col-lg-9">
      <button class="btn btn-primary btn-lg" type="submit">登 录</button>
    </div>
  </div>
  <input type="hidden" name="referer" value=""/>
  <input type="hidden" name="datatype" value="json"/>
  <input type="hidden" name="Submit" value="true"/>
</form>


<!--Page Related Scripts-->
<script src="{echo AURL}/js/validation/bootstrapValidator.js"></script>

<script>
 
        $(document).ready(function () {

 		  $('#loginForm').bootstrapValidator({
                excluded: [':disabled'],
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                submitHandler: function (form) {

				$('#LoginModal').modal('hide');
				bootbox.hideAll();
 
				  $.post("{echo U('/get/login/index')}",$("#loginForm").serialize(), function(json) {
					
					  	$('.bootbox').PhpappProgress({json:json});

				 		return true;
					
				  }, 'json');
		

				 bootbox.dialog({
					 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
					 title: '<i class="icon fa fa-retweet"></i> 登录中',
					 closeButton: false
				 }).PhpappProgress({time:1000});
			 
				  return false; 
				 
                }
			 ,
                fields: {

				seccode:{
					 validators: {
						 notEmpty: {
						    message: '<i class="fa fa-frown-o"></i> 对不起！请输入验证码！'
						}, stringLength: {
						   min: 4,
						   message: '<i class="fa fa-frown-o"></i> 对不起！验证码小于4位！'
					   }
					 }
				}
                }
			
            }) 

        });
	   

	   $(function(){
		     $("i[data-bv-field='remember']").remove();
	   });

    </script>
